package com.atguigu.gulimall.cart.config;

import com.atguigu.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * SpringMVC配置
 *
 * @author DuGuanghan
 * @since 2024-08-16 10:39:06
 */
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {
    /**
     * 添加拦截器
     *
     * @param registry 注册表
     * @author DuGuanghan
     * @since 2025-02-14 11:22:19
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
    }
}
